#ifndef _UNKNOWN_H_
#define _UNKNOWN_H_

#include <crt_util.h>
#include <dlcom/id.hpp>

namespace StdCom
{

interface IBase
{
    std_method(QueryInterface)(REFIID riid, void** ppv) PURE;
    std_method_(ULONG, AddRef)() PURE;
    std_method_(ULONG, Release)() PURE;
};

// {00000000-0000-0000-0000-000000000046}
_DEF_IID(IID_IBase, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);

interface IClsFactory : public IBase
{
    std_method_(HRESULT, CreateInstance)(IBase* pUnkOuter, REFIID riid, void** ppvObject) PURE;
    std_method_(HRESULT, LockServer)(int fLock) PURE;
};

// {00000001-0000-0000-0000-000000000046}
_DEF_IID(IID_IClsFactory, 0x000000001, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);

// {00000000-0000-0000-0000-000000000000}
_DEF_IID(IID_INULL, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);

#define INULL ((IBase*)0)

#define rc_com_assert(p, v) \
    { \
        if (!((IBase*)(p))) \
            return v; \
    }

} // namespace StdCom

#endif
